/*
 * Copyright (C), 2002-2017, 苏宁易购电子商务有限公司
 * FileName: LabelController.java
 * Author:   15050536
 * Date:     2017年5月25日 下午2:30:20
 * Description: //模块目的、功能描述      
 * History: //修改记录
 * <author>      <time>      <version>    <desc>
 * 修改人姓名             修改时间            版本号                  描述
 */
package com.suning.sawp.web.controller.member;

import net.sf.json.JSONObject;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.suning.sawp.constants.ErrorCodeConstants;
import com.suning.sawp.dto.common.ReturnMsg;
import com.suning.sawp.member.service.LabelService;
import com.suning.sawp.web.controller.DjBaseController;
import com.suning.sawp.web.exception.MyGsonView;

/**
 * 会员标签的相关功能
 *
 * @author 15050536 石键平
 */
@Controller
@RequestMapping("/client/label/")
public class LabelController extends DjBaseController {

	@Autowired
	private LabelService labelService;

	/**
	 * 查询所有标签，返回给客户端
	 */
	@RequestMapping("queryAllLabel")
	public MyGsonView queryAllLabel() {
		JSONObject json = labelService.queryAllLabel();
		ReturnMsg<JSONObject> returnMsg = new ReturnMsg<JSONObject>();
		if (json != null) {
			returnMsg.setData(json);
		} else {
			returnMsg.setRetFlag(ReturnMsg.FAIL);
			returnMsg.setErrorCode(ErrorCodeConstants.ERR_MEM_0052);
			returnMsg.setErrorMessage(ErrorCodeConstants.ERR_MAP.get(ErrorCodeConstants.ERR_MEM_0052));
		}
		return setGsonViewWithEmpty(returnMsg);
	}

}
